import config from '@/config';
import store from '../store';

let platform;
// #ifdef MP-ALIPAY
platform = 'alipay';
// #endif

// #ifdef MP-WEIXIN
platform = 'wx';
// #endif

export default function(spm) {
  console.log(spm);
  console.log(platform);
  if (config.buildType === 'release') {
    const { userId = '' } = store.state.baseInfo.userInfo;

    uni.request({
      url: `${config.getEnvConfig().logPrefix}/spm?spm=121&userId=${userId}`,
      method: 'POST',
    });
  }
}
